/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entities;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Ignacio
 */
public class Koneksi {
    private static String jdbcURL = "jdbc:mysql://localhost:3306/kp";
    private static String user = "KP";
    private static String password = "kp";
    private static Connection conn = null;

    public static Connection Koneksi() throws ClassNotFoundException, SQLException {
        try {
            Class.forName("org.gjt.mm.mysql.Driver");
            conn = (Connection) DriverManager.getConnection(jdbcURL, user, password);
            System.out.println("koneksi berhasil");
           
        } catch (Exception ex) {

            System.out.println("message:" + ex.getMessage());
        } 
        return conn;
    }
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Koneksi();
    }
}
   
